/** 富文本-插件-表格对齐 */
import { Editor, Plugin } from "tinymce";

class TableAlignPlugin implements Plugin {
  constructor(editor: Editor) {
    editor.ui.registry.addButton("table-align-top", {
      icon: "table-align-top",
      tooltip: "Align Top",
      onAction: () => editor.execCommand("mceTableApplyCellStyle", false, { "vertical-align": "top" }),
    });
    editor.ui.registry.addButton("table-align-center", {
      icon: "table-align-center",
      tooltip: "Portrait center",
      onAction: () => editor.execCommand("mceTableApplyCellStyle", false, { "vertical-align": "middle" }),
    });
    editor.ui.registry.addButton("table-align-bottom", {
      icon: "table-align-bottom",
      tooltip: "Align bottom",
      onAction: () => editor.execCommand("mceTableApplyCellStyle", false, { "vertical-align": "bottom" }),
    });
  }
}

tinymce.PluginManager.add("table-align", TableAlignPlugin as any);
